import request from '@/utils/request'

//***************角色关联权限相关接口*******************


//获取角色相关联的权限
export function getRoleActionsByQuery(params) {
  return request({
    url: '/watchdog/role_actions',
    params: params
  })
}

//给角色赋予权限
export function grantActionsToRole(roleId, actions) {
  return request({
    url: '/watchdog/role_actions',
    method: 'post',
    params: {
      type: 'grant',
      role_id: roleId
    },
    data: actions
  })
}

//解除权限
export function dismissActions(roleId, actionId) {
  return request({
    url: '/watchdog/role_actions',
    method: 'delete',
    params: {
      role_id: roleId,
      action_id: actionId
    }
  })
}
